import numpy as np
from cvxopt import matrix, solvers

# A为[[-1  1]
#     [-1 -1]
# 	  [0  -1]
#     [1  -2]]
A = matrix([[-1.0, -1.0, 0.0, 1.0], [1.0, -1.0, -1.0, -2.0]])
b = matrix([1.0, -2.0, 0.0, 4.0])
c = matrix([2.0, 1.0])
#a = -0.05
#b = 0.05
#c = 0
#d = 1
#e = -1
#f = 1
#g = 0
#h = 0.95

#fa = float(a)
#fb = float(b)
#fc = float(c)
#fd = float(d)
#fe = float(e)
#ff = float(f)
#fg = float(g)
#fh = float(h)
sol = solvers.lp(c,A,b)
print(np.shape(sol['x']),'@@@@@@@@@')
#print(np.dot(sol['x'].T, c),'#########')
#print(sol['primal objective'])

#G = matrix(np.array([[-1.0, 0, 0, 0, 0, 0], [1.0, 0, 0, 0, 0, 0], [0, -1.0, 0, 0, 0, 0], [0, 1.0, 0, 0, 0, 0], [0, 0, -1.0, 0, 0, 0], [0, 0, 1.0, 0, 0, 0], [0, 0, 0, 0, 0, -1.0], [0, 0, 0, 0, 0, 1.0], [0, 0, 0, -1.0, 0, 0], [0, 0, 0, 1.0, 0, 0], [0, 0, 0, 0, -1.0, 0], [0, 0, 0, 0, 1.0, 0], [0, -1.0, 0, 0, 0, -1.0], [0, 1.0, 0, 0, 0, 1.0]]))
#h = matrix(np.array([-fa, fb, -fc, fd, -fc, fd, -fc, fd, -fe, ff, -fe, ff, -fg, fh]))
#print(G)
#print(h)